package cn.cque.utils;

import org.apache.commons.beanutils.Converter;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @ClassName DateConverter
 * @Description
 * @Author XWC
 * @Date 3/1 23:05
 **/
public class DateConverter implements Converter {
    @Override
    public Object convert(Class type, Object value) {
        Date parse = null;
        try {
            String dateStr = (String)value;
            parse = new SimpleDateFormat("yyyy-MM-dd").parse(dateStr);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return parse;
    }
}
